<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('author')->comment('users中的id');
            $table->bigInteger('good_id')->nullable()->comment('good_infos表ID');
            $table->bigInteger('category_id')->default(0)->comment('文章分类, 0为未分类');
            $table->string('title')->nullable()->comment('文章题目,为空时，一般作为商品介绍');
            $table->longText('content')->comment('文章内容');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
